using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class CreateUrls : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        fillData();
    }

    private void fillData()
    {
        gvUrls.DataSource = CreatedUrls;
        gvUrls.DataBind();
    }

    private ArrayList CreatedUrls
    {
        get
        {
            if (Session["CreatedUrls"] != null)
            {
                return (ArrayList)Session["CreatedUrls"];
            }
            else
            {
                Session["CreatedUrls"] = new ArrayList();
                return (ArrayList)Session["CreatedUrls"];
            }
        }
        set
        {
            Session["CreatedUrls"] = value;
        }

    }

    protected void btnAdd_Click(object sender, EventArgs e)
    {
        CreatedUrls.Add(new UrlData(tbUrl.Text, Convert.ToInt32(tbLevel.Text)));
        tbLevel.Text = string.Empty;
        tbUrl.Text = string.Empty;
        fillData();
    }
    protected void btnGetContent_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/GetContent.aspx");
    }

}
